from flask import Flask,session

"""
1. 请求刚刚达到:
  ctx = RequestContext(...)
    - request
    - session=None
  ctx.push()
    ctx.session = SecureCookieSessionInterface.open_session

2. 视图函数

3. 请求结束
  SecureCookieSessionInterface.save_session()
"""

app = Flask(__name__)
app.secret_key = 'sadfasdfasdf'
@app.route('/x1')
def index():
    session['k1'] = 123
    return "Index"

@app.route('/x2')
def order():
    print(session['k1'])
    return "Order"

if __name__=="__main__":
    app.run()
    
    # 1. 请求一旦到来,
    app.__call__
    app.wsgi_app  
    app.open_session()
